<style>
   .dataTables_info{float:left;}
   .dataTables_paginate{float:right};
   </style>
<div class="modal hide fade in" id="wuliu_info" style="top: 50%;">
   <div class="modal-header">
       <button type="button" class="close" data-dismiss="modal">×</button>
       <h3>快递详细信息查询</h3>
   </div>
   <div class="modal-body" style="text-align: center;">
   	<img src="/img/loading_b.gif" style="margin: 0 auto;"/>
   </div>
   <div class="modal-footer">
      <a href="#" class="btn" data-dismiss="modal">关闭</a>
   </div>
</div>
        <div class="span10">
          <div class="row-fluid">
            <div class="span12 box">
                <div class="box-head">
                    <h3><i class="icon-white icon-shopping-cart" style="margin-top: 7px;"></i> 所有订单</h3>
                </div>
                <div class="box-content">
                    <div class="content-inner">
                    <div class="marg20-btm">
                            所有 <span class="badge badge-inverse"><?php echo $order_num['total_rows']-$order_num['ok_rows'];?></span> | 待付款 <span class="badge badge-important"><?php echo $order_num['nopay_rows'];?></span> | 等待确认 <span class="badge badge-warning"><?php echo $order_num['nook_rows'];?></span> | 已关闭 <span class="badge"><?php echo $order_num['close_rows'];?></span>
                        </div>
                        <table class="table table-bordered " id="datatable">
                          <thead>
                              <tr>
                              	<th>订单编号</th>
                                <th>创建日期</th>
                                <th>运单号</th>
                                <th>收货地址</th>
                                <th>收货人</th>
                                <th>收货电话</th>
                                <th>状态</th>
                                <th>操作</th>
                              </tr>
                            </thead>
                            <tbody>
                            <?php foreach ($orderData as $k=>$v):?>
                            <?php foreach($v['info'] as $i=>$j):;?>
                              <tr>
                              <?php if($i == 0){ ?>
                              	<td rowspan="<?php echo count($v['info']); ?>"><?php echo $v['order_id'];?></td>
                                <td rowspan="<?php echo count($v['info']); ?>"><?php echo date('Y-m-d H:i:s',$v['crea_time']);?></td>
                                <?php } ?>
                                <td><?php echo ($j['post_number']==0)?'--':$j['post_number'];?></td>
                                <?php 
                                switch ($v['shop_type'])
                                {
                                	case 0://空包
                                		echo '<td>'.$j['post_address'].'</td><td>'.$j['post_name'].'</td><td>'.$j['post_tel'].'</td>';
                                		switch ($v['static'])//订单状态
                                		{
                                			case 0:
		                                		echo '<td><span class="label label-important">未付款</span></td>';
		                                		if($i == 0)
		                                		{
		                                			echo '<td rowspan="'.count($v['info']).'">'.
			                                			'<div class="btn-group"><a href="'.site_url('member/order_center/pay?oid='.$v['order_id']).'" rel="tooltip" title="付款" class="btn btn-success"><i class="icon-barcode"></i></a>'.
			                                			'<button onclick="if(confirm(\'确定要关闭？次操作不可逆.\')){window.location.href = \''.site_url('member/order_center/closeOrder?oid='.$v['order_id']).'\'}" rel="tooltip" title="关闭" class="btn"><i class="icon-off"></i></button></div>'.
			                                			'</td>';
		                                		}
                                				break;
                                			case 1://已付款订单
		                                		switch($j['post_static'])//子订单状态
		                                		{
		                                			case 0;
		                                			echo '<td><span class="label label-warning">等待确认</span></td>';
		                                			break;
		                                			case 1:
		                                			echo '<td><span class="label label-success">已完成</span></td>';
		                                			break;
		                                			case 2:
		                                			echo '<td><span class="label label-info">申请底单中</span></td>';
		                                			break;
		                                		}
		                                		echo '<td><div class="btn-group"><a href="javascript:void(0);" info_static=0 post_number="'.$j['post_number'].'" rel_add="popover"  title="查询物流信息" class="btn btn-info"><i class="icon-plane"></i></a>';
		                                		echo '<button title="底单申请" onClick="window.location.href = \''.site_url('member/order_center/getBill?rid='.$j['id']).'\'" class="btn" rel="tooltip" ';
												echo ($j['post_static'] == 2)?'disabled':'';
												echo '><i class="icon-picture"></i></button></div></td>';
                                				break;
                                			case 2: //已完成
		                                		echo '<td><span class="label label-success">已完成</span></td>';
		                                		break;
                                			case 3://已关闭订单
		                                		if($i == 0)
		                                		{
		                                			echo '<td rowspan="'.count($v['info']).'"><span class="label">已关闭</span></td><td rowspan="'.count($v['info']).'"> </td>';
		                                		}
                                				break;
                                		}
                                		break;
                                	case 1: //转账订单
                                		break;
                                	case 2://底单申请订单
                                		echo '<td colspan="3" align="center">*该订单为申请底单订单</td>';
                                		switch ($v['static'])//订单状态
                                		{
                                			case 0:
		                                		echo '<td><span class="label label-important">未付款</span></td>';
		                                		if($i == 0)
		                                		{
		                                			echo '<td rowspan="'.count($v['info']).'">'.
			                                			'<div class="btn-group"><a href="'.site_url('member/order_center/pay?oid='.$v['order_id']).'" rel="tooltip" title="付款" class="btn btn-success"><i class="icon-barcode"></i></a>'.
			                                			'<button onclick="if(confirm(\'确定要关闭？次操作不可逆.\')){window.location.href = \''.site_url('member/order_center/closeOrder?oid='.$v['order_id']).'\'}" rel="tooltip" title="关闭" class="btn"><i class="icon-off"></i></button></div>'.
			                                			'</td>';
		                                		}
                                				break;
                                			case 1://已付款订单
		                                		echo '<td colspan="2"><span class="label label-info">底单上传中</span></td>';
                                				break;
                                			case 2: //已完成
		                                		echo '<td><span class="label label-success">已完成</span></td>';
		                                		break;
                                			case 3://已关闭订单
		                                		if($i == 0)
		                                		{
		                                			echo '<td rowspan="'.count($v['info']).'"><span class="label">已关闭</span></td><td rowspan="'.count($v['info']).'"> </td>';
		                                		}
                                				break;
                                		}
                                		break;
                                }
                                ?>
                              </tr>
                              <?php endforeach;?>
                              <?php endforeach;?>
                            </tbody>
                          </table>
                         <style>
                         .page{height:30px;}
                         .btn-group{float:left;}
                         p{text-align: center;}
                         .popover-inner{width:600px;}
                         .popover-content p{max-height: 351px;overflow: hidden;}
                         </style>
                         <script type="text/javascript">
                         var content = '<div class="post_number_info"><img src="img/loading_s.gif"/></div>';
                         $('a[rel_add=popover]').mouseover(function(){
                             if($(this).attr('info_static') == 0)
                             {
                                 var post_number = $(this).attr('post_number');
                            	 $.post('<?php echo site_url('member/order_center/showNumberInfo');?>',{'post_number':post_number,'line':5},function(data){
                                	 $('a[post_number='+post_number+']').attr({'data-content':data['info'],'info_static':1});
                                	 $('.post_number_info').html(data['info']);
                                	 $('#wuliu_info .modal-body').html(data['info']);
                                 },'json');
                             }
                         }).click(function(){
                        	 $('#wuliu_info .modal-body').html($(this).attr('data-content'));
                        	 $('#wuliu_info').modal('show');
                             }).popover({'placement':'left','content':content});
                         </script>
                        <div class="page">
	                       	<?php echo $page;?>
                        </div>
                    </div><!-- content-inner -->
                </div>
            </div>
          </div> <!-- end row -->

        </div><!--/span-->
      </div><!--/row-->